home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Utilities / Converters / Convert_MacPaint / Source / shared.subproj / RCS / ErrorInfo.rtf,v < prev    next >
Text File  |  1995-06-12  |  9KB  |  455 lines

  1. head     1.4;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @@;
  7.  
  8.  
  9. 1.4
  10. date     92.04.27.20.35.51;  author death;  state Exp;
  11. branches ;
  12. next     1.3;
  13.  
  14. 1.3
  15. date     92.03.29.12.11.08;  author death;  state Exp;
  16. branches ;
  17. next     1.2;
  18.  
  19. 1.2
  20. date     92.02.09.18.43.55;  author death;  state Exp;
  21. branches ;
  22. next     1.1;
  23.  
  24. 1.1
  25. date     92.02.09.14.01.00;  author death;  state Exp;
  26. branches ;
  27. next     ;
  28.  
  29.  
  30. desc
  31. @Documentation for the ErrorInfo object.
  32. @
  33.  
  34.  
  35. 1.4
  36. log
  37. @Unknown miscelaneous changes
  38. @
  39. text
  40. @{\rtf0\ansi{\fonttbl\f0\fnil Palatino-Roman;\f1\ftech Symbol;\f2\fnil NewCenturySchlbk-Roman;}
  41. \paperw14520
  42. \paperh13980
  43. \margl120
  44. \margr0
  45. \pard\tx5700\tx11360\f0\b0\i0\ul0\fs24 $Revision: 1.3 $    $Author: death $    $Date: 92/03/29 12:11:08 $\
  46.  
  47. \pard \
  48.  
  49. \pard\tx3120\tx3620\tx4120\fs16\li2620 \
  50.  
  51. \fs28 \
  52.  
  53. \fs16 \
  54.  
  55. \fs28 \
  56.  
  57. \fs16 \
  58.  
  59. \pard\b\li1100 \
  60. \
  61. \
  62. \
  63.  
  64. \fs36 ErrorInfo\
  65.  
  66. \fs16 \
  67.  
  68. \pard\tx7140\b0\fs28\li2100 INHERITS FROM    Object\
  69.  
  70. \fs16 \
  71.  
  72. \fs28 DECLARED IN    ErrorInfo.h\
  73.  
  74. \fs16 \
  75. \
  76. \
  77.  
  78. \fs28 CLASS DESCRIPTION\
  79.  
  80. \fs16 \
  81.  
  82. \pard\tx3120\tx3620\tx4120\fs28\li2620 ErrorInfo is a class designed to be used as the return value from the method of some other object.  That is, instead of merely returning a numeric code reflecting the error state, an object would return an ErrorInfo object.  An ErrorInfo object contains more than just an error code, and therefore should be more usefull to the code that called the method than a simple number.\
  83.  
  84. \fs16 \
  85.  
  86. \fs28 The ErrorInfo object is designed to be a minimal set of error information, and it is expected that some applications will need to subclass it to provide more specialized information than ErrorInfo does.\
  87.  
  88. \fs16 \
  89.  
  90. \fs28 ErrorInfo keeps three instance variables: a flag indicating what kind of error this is reporting, an error code, and a null C string describing the error.  The values of the string and code are error specific, and are not dictated by the object.  There are three kinds of error kind flags defined as part of the object: ERRKIND_GENERAL, ERRKIND_OS, and ERRKIND_USER.  The first is the one that is used by default.  An errKindOS indicates that the error code being returned is from an operating system problem (e.g. an error code when trying to call 
  91. \b fopen()
  92. \b0 ).  The final might be used when an error is being reported based on a user's actions (e.g. the user clicked on an object they shouldn't have).\
  93.  
  94. \fs16 \
  95.  
  96. \fs28 ErrorInfo provides methods to access each of these values, a method to free the object, and two creation methods.  Note that the creation methods are the only way to store values in the error object.\
  97.  
  98. \fs16 \
  99.  
  100. \fs28 Using an ErrorInfo object is straightforward. A method might create an ErrorInfo object using newErrorWithCode:Text:Kind:, and then merely return it to the caller.  The caller, in turn, might retrieve the error text using getErrorText and then free the object.\
  101.  
  102. \fs16 \
  103.  
  104. \b\fs28 Note:
  105. \b0  by convention, a method that returns an ErrorInfo object will return a nil object pointer if there were no errors.\
  106.  
  107. \fs16 \
  108.  
  109. \pard\tx7140\li2100 \
  110. \
  111.  
  112. \fs28 INSTANCE VARIABLES\
  113.  
  114. \fs16 \
  115.  
  116. \pard\tx6640\tx9660\tx10180\i\fs28\fi-4040\li6640 Inherited from Object
  117. \i0     Class    isa;\
  118.  
  119. \fs16 \
  120.  
  121. \i\fs28 Declared in ErrorInfo
  122. \i0     long int    errorKind;\
  123.     Cstring    errorText;
  124. \pard\tx9660\tx10180\fi-520\li7140 \
  125. long int    errorCode;\
  126.  
  127. \pard\tx7140\tx10180\tx10680\fs16\fi-4540\li7140 \
  128.  
  129. \fs28 errorKind     A flag describing the kind of error described here\
  130.  
  131. \fs16 \
  132.  
  133. \fs28 errorText     String providing description of the error\
  134.  
  135. \fs16 \
  136.  
  137. \fs28 errorCode     The numeric value representing the error\
  138.  
  139. \pard\tx7140\fs16\li2100 \
  140. \
  141. \
  142.  
  143. \fs28 METHOD TYPES\
  144.  
  145. \fs16 \
  146.  
  147. \pard\tx7140\tx10180\tx10680\fs28\fi-4540\li7140 Creating/Initializing, and Freeing    
  148. \f1 - 
  149. \f0 newErrorWithCode:Text:Kind:\
  150.  
  151. \pard\tx10180\tx10680\f1\fi-520\li7660 - 
  152. \f0 newErrorWithCode:Text:\
  153.  
  154. \f1 - 
  155. \f0 free\
  156.  
  157. \pard\tx7140\tx10180\tx10680\fs16\fi-4540\li7140 \
  158.  
  159. \fs28 Accessing error values    
  160. \f1 - 
  161. \f0 getErrorKind \
  162.  
  163. \pard\tx10180\tx10680\f1\fi-520\li7660 - 
  164. \f0 getErrorText \
  165.  
  166. \f1 - 
  167. \f0 getErrorCode\
  168.  
  169. \pard\tx7140\fs16\li2100 \
  170. \
  171. \
  172.  
  173. \fs28 CLASS METHODS\
  174.  
  175. \fs16 \
  176.  
  177. \b \
  178.  
  179. \b0\fs28 none\
  180.  
  181. \pard\tx3120\tx3620\tx4120\fs16\li2620 \
  182.  
  183. \pard\tx7140\li2100 \
  184. \
  185.  
  186. \fs28 INSTANCE METHODS\
  187.  
  188. \fs16 \
  189.  
  190. \b \
  191.  
  192. \fs28 initErrorWithCode:Text:Kind:\
  193.  
  194. \pard\b0\fi-1020\li3620 - (id) 
  195. \b initErrorWithCode: 
  196. \b0 (long int) 
  197. \i code
  198. \b\i0  Text: 
  199. \b0 (Cstring) 
  200. \i text
  201. \b\i0  Kind: 
  202. \b0 (long int) 
  203. \i kind
  204. \b\i0 \
  205.  
  206. \fs16 \
  207.  
  208. \pard\tx3120\tx3620\tx4120\b0\fs28\li2620 Creates a new ErrorInfo object, assigning the values of code, kind and text to its instance variables.  Note that the entire text is duplicated, not just the pointer. \
  209.  
  210. \pard\tx7140\fs16\li2100 \
  211.  
  212. \b \
  213.  
  214. \fs28 initErrorWithCode:Text:\
  215.  
  216. \pard\b0\fi-1020\li3620 - (id)
  217. \b  initErrorWithCode: 
  218. \b0 (long int) 
  219. \i code
  220. \b\i0  Text: 
  221. \b0 (Cstring) 
  222. \i text
  223. \b\i0 \
  224.  
  225. \fs16 \
  226.  
  227. \pard\tx3120\tx3620\tx4120\b0\fs28\li2620 Calls 
  228. \b newErrorWithCode:Text:Kind:
  229. \b0  using errKindGeneral for the 
  230. \i kind
  231. \i0  parameter.  This, then, simply serves as a more common case wrapper around the preceeding method.\
  232.  
  233. \pard\tx7140\fs16\li2100 \
  234.  
  235. \b \
  236.  
  237. \fs28 free\
  238.  
  239. \pard\b0\fi-1020\li3620 - 
  240. \b free\
  241.  
  242. \fs16 \
  243.  
  244. \pard\tx3120\tx3620\tx4120\b0\fs28\li2620 Disposes of the instance values of the method and frees the object..\
  245.  
  246. \pard\tx7140\fs16\li2100 \
  247.  
  248. \b \
  249.  
  250. \fs28 getErrorKind\
  251.  
  252. \pard\f1\b0\fi-1020\li3620 - 
  253. \f0 (long int) 
  254. \b getErrorKind\
  255.  
  256. \fs16 \
  257.  
  258. \pard\tx3120\tx3620\tx4120\b0\fs28\li2620 Returns the kind of the error object (see constants, below, for a list of kinds).\
  259.  
  260. \fs16 \
  261.  
  262. \pard\tx7140\b\li2100 \
  263.  
  264. \fs28 getErrorText\
  265.  
  266. \pard\f1\b0\fi-1020\li3620 - 
  267. \f0 (Cstring) 
  268. \b getErrorText\
  269.  
  270. \fs16 \
  271.  
  272. \pard\tx3120\tx3620\tx4120\b0\fs28\li2620 Returns a copy of the text of the error object to the caller.  Note that this means that the caller is responsible for disposing the text at their leisure.\
  273.  
  274. \fs16 \
  275.  
  276. \pard\tx7140\b\li2100 \
  277.  
  278. \fs28 getErrorCode\
  279.  
  280. \pard\f1\b0\fi-1020\li3620 - 
  281. \f0 (long int) 
  282. \b getErrorCode\
  283.  
  284. \fs16 \
  285.  
  286. \pard\tx3120\tx3620\tx4120\b0\fs28\li2620 Returns the error code stored in the object.\
  287.  
  288. \fs16 \
  289.  
  290. \pard\tx7140\li2100 \
  291. \
  292.  
  293. \fs28 BUGS AND PROBLEMS\
  294.  
  295. \fs16 \
  296.  
  297. \pard\tx3120\tx3620\tx4120\fs28\li2620 If the caller wants controll over where the string returned by getErrorText is allocated, they're up the proverbial creek.\
  298.  
  299. \fs16 \
  300.  
  301. \pard\tx7140\li2100 \
  302. \
  303.  
  304. \fs28 ENHANCEMENT IDEAS\
  305.  
  306. \fs16 \
  307.  
  308. \pard\tx3120\tx3620\tx4120\fs28\li2620 none\
  309.  
  310. \fs16 \
  311.  
  312. \pard\tx7140\li2100 \
  313. \
  314.  
  315. \fs28 CONSTANTS AND DEFINED TYPES\
  316.  
  317. \fs16 \
  318.  
  319. \pard\tx6480\tx7180\fs24\li2620 /* ErrInfo kinds of errors */\
  320. #define ERRKIND_NONE    0    // Do not use this kind.  Return NULL instead.\
  321. #define ERRKIND_GENERAL    1\
  322. #define ERRKIND_USER    2\
  323. #define ERRKIND_OS    3\
  324.  
  325. \pard\tx3120\tx3620\tx4120\fs16\li2620 \
  326.  
  327. \pard\tx7140\li2100 \
  328. \
  329.  
  330. \fs28 MODIFICATION HISTORY\
  331.  
  332. \fs16 \
  333.  
  334. \pard\tx3120\tx3620\tx4120\fs28\li2620 $Log:    ErrorInfo.rtf,v $
  335. Revision 1.3  92/03/29  12:11:08  death
  336.  turns out that 2.0 wants init calls to be in the object, not the class.
  337. Modifed doc to reflect corresponding changes in the source
  338. Revision 1.2  92/02/09  18:43:55  deathRremoved listed bug that stated that no error checking was being done.  All reasonable checking is now being done.\
  339.  
  340. \b Revision 1.1
  341. \b0   92/02/09  14:01:00  death\
  342.  
  343. \fi-20\li3120 Initial revision\
  344.  
  345. }
  346. @
  347.  
  348.  
  349. 1.3
  350. log
  351. @ turns out that 2.0 wants init calls to be in the object, not the class.
  352. Modifed doc to reflect corresponding changes in the source
  353. @
  354. text
  355. @d6 1
  356. a6 1
  357. \pard\tx5700\tx11360\f0\b0\i0\ul0\fs24 $Revision: 1.2 $    $Author: death $    $Date: 92/02/09 18:43:55 $\
  358. d295 5
  359. a299 1
  360. \pard\tx3120\tx3620\tx4120\fs28\li2620 $Log:    ErrorInfo.rtf,v $Revision 1.2  92/02/09  18:43:55  deathRremoved listed bug that stated that no error checking was being done.  All reasonable checking is now being done.\
  361. @
  362.  
  363.  
  364. 1.2
  365. log
  366. @Rremoved listed bug that stated that no error checking was being done.  All reasonable checking is now being done.
  367. @
  368. text
  369. @d3 1
  370. a3 1
  371. \paperh11740
  372. d6 1
  373. a6 1
  374. \pard\tx5700\tx11360\f0\b0\i0\ul0\fs24 $Revision: 1.1 $    $Author: death $    $Date: 92/02/09 14:01:00 $\
  375. d109 1
  376. a109 1
  377. \f1 + 
  378. d112 1
  379. a112 1
  380. \pard\tx10180\tx10680\f1\fi-520\li7660 + 
  381. d115 1
  382. a115 1
  383. \f1 + 
  384. d140 13
  385. d155 1
  386. a155 1
  387. \pard\b0\fi-1020\li3620 + (id) 
  388. d177 1
  389. a177 1
  390. \pard\b0\fi-1020\li3620 + (id)
  391. d200 1
  392. a200 1
  393. \pard\b0\fi-1020\li3620 + 
  394. d207 1
  395. a207 1
  396. \fs16 \
  397. a208 7
  398. \pard\tx7140\li2100 \
  399. \
  400.  
  401. \fs28 INSTANCE METHODS\
  402.  
  403. \fs16 \
  404.  
  405. d295 1
  406. a295 1
  407. \pard\tx3120\tx3620\tx4120\fs28\li2620 $Log:    ErrorInfo.rtf,v $\
  408. @
  409.  
  410.  
  411. 1.1
  412. log
  413. @Initial revision
  414. @
  415. text
  416. @d1 1
  417. a1 1
  418. {\rtf0\ansi{\fonttbl\f4\fnil Palatino-Roman;\f1\ftech Symbol;\f3\fnil NewCenturySchlbk-Roman;}
  419. d6 1
  420. a6 1
  421. \pard\tx5700\tx11360\f4\b0\i0\ul0\fs24 $Revision: 1.1 $    $Author: death $    $Date: 92/02/09 12:06:36 $\
  422. d110 1
  423. a110 1
  424. \f4 newErrorWithCode:Text:Kind:\
  425. d113 1
  426. a113 1
  427. \f4 newErrorWithCode:Text:\
  428. d116 1
  429. a116 1
  430. \f4 free\
  431. d122 1
  432. a122 1
  433. \f4 getErrorKind \
  434. d125 1
  435. a125 1
  436. \f4 getErrorText \
  437. d128 1
  438. a128 1
  439. \f4 getErrorCode\
  440. d208 1
  441. a208 1
  442. \f4 (long int) 
  443. d222 1
  444. a222 1
  445. \f4 (Cstring) 
  446. d236 1
  447. a236 1
  448. \f4 (long int) 
  449. a252 1
  450. Most of the code basically ignores checking for errors when making system calls (ironic, eh?)\
  451. d292 1
  452. a292 1
  453. \b0   92/02/09  12:06:36  death\
  454. @
  455.